package com.hyg.common;

import android.content.Context;
import android.text.TextUtils;

import com.hyg.common.utils.FileUtils;

/**
 * FileName: CommonLibary
 * Author: huangyuguang
 * Date: 2022/5/6
 * Description: 初始化
 */
public class CommonLibary {
    public static Context context;

    public static void init(Context context){
        CommonLibary.context = context.getApplicationContext();
        if(TextUtils.isEmpty(FileUtils.downPath)){
            FileUtils.downPath = FileUtils.getFilesPath(getContext()) + "/download/";
        }
    }

    /**
     * 获取ApplicationContext
     *
     * @return ApplicationContext
     */
    public static Context getContext() {
        if (context != null) return context;
        throw new NullPointerException("u should init first");
    }
}
